<!--
 * @Author: your name
 * @Date: 2022-03-18 13:47:22
 * @LastEditTime: 2022-03-18 17:56:30
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\geyao\前端原型和原型链220318.html
-->
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>前端原型和原型链</title>
	</head>
	<body>
		<script>
			//构造函数
			// 实例成员： 实例成员就是在构造函数内部，通过this添加的成员。实例成员只能通过实例化的对象来访问。

			// 静态成员： 在构造函数本身上添加的成员，只能通过构造函数来访问
			
			function Animai(name, age) {
				this.name = name
				this.age = age
			}

			Animai.length = '2m'
			let dog = new Animai('小狗', '4')
			console.log(dog, 'dog')
			//Animai {name: '小狗', age: '4'} 'dog'

			let cat = new Animai('小猫', '5')
			console.log(cat, 'cat')
			//Animai {name: '小猫', age: '5'}

			console.log(dog.length, 'length')
			console.log(Animai.length, 'length')
			//undefined 'length'
			// Animai 2
		</script>
	</body>
</html>
